The task in question involed the combination of:

- An Arduino Board
- Breadboard
- Range of Resistors
- 4 Buttons
- RGB LED
- Potentially, something extra

Notwithstanding, I decided to implement a Processing sketch, that would gradually and accordingly manipulate with the brightness of the RGB LED.




- Recollecting how sketches work and how to connect one to another takes sometime
- Exchanging the data between Arduino and Processing can get tricky. Something not working usually won't tell you directly why it ain't until you perform an in-depth analysis
- Obviously, Arduino can get quite frequently very annoying, as the uploaded sketch will rebuke you quite often with a statement, that it is busy. Its time being soo precious, daum Arduinos, taking over the world, stealing our rare earth elements etc. ._.
- Getting to know which is Blue/Red/Green in the RGB LED may be tricky, it ain't color coded, so it's more of a set of trials to get the pins and values right
- How do I send multiple values through serial? There must be a way, probably via an array, but mine did not quite work at the time
- Processing code works somewhat unexpectedly at times. For instance, if the clicked-on value is recorded as a value smaller than 0, Arduino will treat it as some sort of a maximum value. Hypothesis based on my RGB LED getting quite very very bright
- The buttons did not always quite work and I remain unsure as to why.



- I successfully managed to get my setup working, so I'd say job well done. The RGB LED got bright. The buttons did trigger it lighting up. The Processing sketch did exactly the same as well. So everything really went well, all things considered?

- I found ways a variety of ways to manipulate with the RGB LED using a simple function based on a mouse press and monitoring its position on a processing sketch's canvas

- I was able to supplement the Processing sketch with two dimensions, X values changed one particular LED and Y values changed another. I'm planning on exploring additional dimensions



- The Arduino gets dodgy and the buttons can demonstrate how dodgy they are every now and then, getting eventually on my nerves a bit.

- One problem I encountered was, well, that I could not send multiple values via the serial. This particular communication form is a tricky one, as it seems that the communication needs to be clearly managed. In theory many ways to send data may be introduced, however the main Serial type remains in terms of Arduino and its bandwidth along with data receival interpretation

My main point is, that the communication needs to be utilised with care


//Arduino Code

      int redPin = 11;
int bluePin = 12;
int greenPin = 13;
int redPin2 = 2;
int greenPin2 = 3;
int bluePin2 = 4;

char val1;
char val2;
char val3;

void setup() {
  // put your setup code here, to run once:

Serial.begin(9600);
  
  pinMode(redPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  pinMode(greenPin, OUTPUT);
}

void loop() {

  if (Serial.available())
  { val1 = Serial.read();
setColor2(val1,val1,val1);
  delay(10);
  Serial.print(val1);
  // put your main code here, to run repeatedly:
}
else{
    setColor(255,255,255);
}
}

void setColor(int red, int green, int blue)
{
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);  
}

void setColor2(int red2, int green2, int blue2)
{
  analogWrite(redPin2, red2);
  analogWrite(greenPin2, green2);
  analogWrite(bluePin2, blue2);  
}
//Processing code

  import processing.serial.*;

Serial myPort1;  // Create object from Serial class
Serial myPort2;
Serial myPort3;
String val1;     // Data received from the serial port
String val2;
String val3;

void setup()
{
  size(400,400);
  // I know that the first port in the serial list on my mac
  // is Serial.list()[0].
  // On Windows machines, this generally opens COM1.
  // Open whatever port is the one you're using.
  String portName = Serial.list()[0]; //change the 0 to a 1 or 2 etc. to match your port
  myPort1 = new Serial(this, portName, 9600);
}

void draw()
{
  rect(0,0,100,100);
  
  if ((mousePressed == true) && (mouseX<200 && mouseY < 200)) 
  {                           //if we clicked in the window
   myPort1.write(mouseX/2);         //send a 1
   println(mouseX/2, mouseY/2, myPort1);    
  }
}

8. a) What would you do differently during this process?

I probably would have looked into using Firmata from the very beginning when I started to develop the Processing sketch.

8. b) Does this tutorial inspire any idea?

Sort of. We may use an RGB LED in our project or even thousands. But I was more inspired by the processing sketch. After all, we could develop an Android app, with which we could manipulate many different things, such as the RGB LED (stripes).

8. c) How can the exercise be extended?

I believe that I already extended the exercise onto implementing the Processing sketch and integrating it with my Arduino setup.


First of all, a few words to clarify some ambiguities around, well, my first blog post - all in all.

I decided to make the first blog post appear on my website. Why? Well, I kept on writing on canvas and at some point, I figured that preloading some of my images and videos could be a quite nice idea. And so I threw in the images I took from onedrive, which didn't work at first, but I found a nice workaround. However, once I embedded a video, which had to take place via html code, suddenly my canvas website redirected me... well, you guessed it! Right to the video, that I just embedded. Dreary of the malicious effects that could have made, I went back and... well, it's all self-explanatory: all progress was lost.

So what could I do, eh? Gotta learn from my past mistakes, so here's one, due for consultation, naturally as it sort of violates what was agreed upon: my very first blog post lands on... my webiste. Which has a few nice implications if you think about it, I mean at some point I might want to share what I have created throughout this course right? What better way to document and at the very same time upskill and dedicate my time for developing my web design skills, other than actually keeping in touch and working on both at the same time?

Secondly, it must be stated at this point, that I did not have access to canvas, until, well at the very least Wednesday. As my special consideration finally did get through on Tuesday and once I inspected on my access to the Lab/Studio units... Well, these were not there yet, despite my sydney student units of study having been updated. Then came Wednesday, throughout which I just literally did nothing, worn down by the previous, really heavy and demanding days. And today is Thursday, so I checked whether the canvas site did get updated. And so it did, but now obviously I had to deliver all my documentation. But that, got corrupted in the end. So, if I may ask to receive a 'lille bit of leeway, as I could not just simply launch my documentation artillery just yet. But here it comes!


Thirdly, probably lastly, although in fact, last but not least! I actually already have had been in touch with Arduino, on... well, two instances to be precise. Although actually three, but on this one particular time, I just saw this mystical Arduino thingy as something straight out of sci-fi, magical little thingies, that you gotta program and hell if I wasn't really incompetent at the time with, well, programming. 'Cause the only time I ever had been in touch with practically implementing anything related, was during Design Programming and for that particular course (note, I did it 3 years ago), I did not receive the feedback for the last 2 assignments (out of 3), so how would I know how good my skills were in the first place? Regardless, the two instances, in which I did actually quite a bit of coding, were overseas, when I co-developed a, what I still find as, nice little idea, that included an Arduino MEGA, midi-controller, some.. well, in fact: lots of power, some electro-mechanical pieces and a range of capacitors meant for blowing up in the accompaniment of played music at the time. The project did not get that far, but we did a bit of bl... empirical testing in terms of how effective our hypothesis regarding sound effects generated by exploding components was. Which to our delight - quite successful indeed, but it might have violated some safety laws, therefore we carried on with a limited amount of piezzo speakers.

Nonetheless, I am mentioning the last project for a specific reason. I have completed that one last semester, raised in great pain, semi-functioning, yet reasonably stunning and totally unexpected in terms of how far I managed single-handedly take this project and to what resolution and fidelity it did actually become developed. The idea involved assisting a potential large percentage of Australian, or even world-wide population of overweight and obese, in losing weight by the use of the ketogenic diet. As I was explicitly told, that per the name of Product Design course, I was expected to produce an actual physical product, thereon I managed to develop, carry out and build an actual weight scale, that sort of worked. It was connected to an Android app built in Processing via bluetooth and the scale itself, was equipped with a pulse sensor, load sensors and many more components meant for increasing overall user experience. It was, however, a quite dodgy and overall tricky setup. It was my first time that I attempt at building an application for Android, which in fact was really a hack, as I used Processing. It was also my first attempt at building a refined physical product and I actually managed to do it singlehandedly in just merely a week's time due to my parts being shipped for the same amount of time dedicated to building the device and a few major changes to my concept that were introduced throughout the semester. What's the point of me telling all of this, you may ask? Well, I did go through some key details in terms of my knowledge and... well, one final thing: my entire sparkfun kit was literally still buried in my magnificent, sanded-wooden weightscale.

Weight Scale

Free da Cable!

The good thing about it, was that I didn't glue all of the components. The bad thing was, some I actually had to, hence I managed to actually trap my USB cable within. Let's rollback a little. The setup was quite straightforward and some other elements I did glue along, such as the load sensors. But these surprisingly were easy to detach, so no harm done. The cable was trickier as there was no clean way of getting that out, it was just simply stuck: from each side. So, I had to look for some sort of devices that would help me get that beautiful weight scale open and considering that DMAF wasn't open in between our lecture and tutorial, then I had to make use of what I had. No powertools unfortunately, thereby all hail the mighty screwdriver.

Well, it still took me around 10-15 minutes to get that freed, I mean it was not much of a prison break, as the entire wooden structure began to crumble once I started sawing it off with my blunt instrument. Which introduced some hazard such as: pointy debris, potent of delivering some nasty splinters and my fingers after a few minutes of work did eventually start to get quite weary and even worn down, but all went according to the plan. At some point, there was enough space to provide the leverage I needed and got the cable out at last! Michael Scofield would've been so proud (anyone seen Prison Break?)

Cable


Now, I had all the components. Literally all, as some were soldered, so I had to figure out which cables I had left, that I could still use for potential tinkering. Then, I moved on to clearing out my breadboard and arduino kit. And voila, now I'm at square one! Happy and dandy, ready to start learning arduino from the very basics, cause I'm a great student, ain't I?

Well, sort of, as I have this nasty tendency of just jumping around. Oh, wait, why is it nasty overall and in the first place? If it wasn't for this ability, I guess I would've never ended up in Australia, right here in MIDEA and right now, well? So, why learn all of the basics, if I could just head on to making an attempt at connecting my RGB LED and integrating it with a processing sketch? Here's an idea: how about manipulating the brightness of the RGB LED by the 'amount' of how far I click on the sketch? Seems like a challenge, considering it's the first tut, right?

So, my first step was quite simple. Let's just plug the damn LED RGB into the arduino board. Yes, yes, I know we were taught it is dangerous 'n all, but the truth is, that the RGB LED does not require any resistors, well, for the purpose, voltage and amperage that the arduino can deliver after all. It was a test, if the thing works, if I get it why it works and what the code is. It was quite some time since I fiddled with all this and well it was a good idea to try fiddling a bit more, I guess?

Prison Break!


So I did get the RGB LED working. Now it was time to make the setup seem, well, at least closer to proper. That worked as well, but I started having trouble finding cables, as like I mentioned before, most were already used to connect the 4 load sensors, amplifier and the combinator. That kind of makes the job a tinier bit more difficult but, as with this kinds of fiddles, ain't it 'tiss a scratch! Or a flesh wound. Anyone watches Monty Python? Wait, was it actually Monty Python?

Either way, after some fiddling, I managed to:

- Get the code for the RGB LED working
- Get the code for Processing working and talking with Arduino via serial.write()
- Get the RGB LED working in accordance with the Processing sketch

Load Sensors


Well, awesome! Just one problem that I could not get quite how to transfer three different values, so that I could freely manipulate with all the three RGB diodes. It seems that I may have to delve into Firmata next week. So in the meantime, I helped out a mate next to me and made an attempt at explaining how Arduino works, why it works and what the code means. I wasn't too great, but I think I might have clarified some details so that he could launch his LED, although there were some Port issues between the Mac and Arduino. Did I ever mention, that Macs keep on breaking down on me? Now to think of it, Windows does too, but not that often (I sweat they break every single time I encounter them) and once they do, in most cases I manage to find a way of getting it fixed properly.

Nevertheless, the most important part, as I was told, was to get one particular setup up and running: that was the button-RGB LED setup. Now, my idea was: hey! How about I do that and... combine it with my processing sketch? It took a bit of iterating the codes in Arduino and Processing, getting the right conditionals and loops... although, actually I might have dropped the loops for now, simple conditionals in theory should have worked. And as per my hypothesis, here's the effect: